<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father{
            overflow: hidden;
            background-color: pink;
            width: 300px;
            height: 300px;
            text-align: center;
            margin: 100px auto;
        }
        .son{
            background-color: purple;
            width: 200px;
            height: 200px;
            margin: 50px;
            color: #fff;
            line-height: 200px;
        }
    </style>
</head>
<body>
    <div class="father">
        <div class="son">son</div>
    </div>
    <script>
        var son = document.querySelector('.son');
        var father = document.querySelector('.father');
        son.addEventListener('click',function(e){
            alert('捕获儿子');
            e.stopPropagation();//阻止冒泡
            // e.cancelBubble = true;//低版本阻止冒泡
        },false)
        father.addEventListener('click',function(){
            alert('捕获父亲');
        },false)
        document.addEventListener('click',function(){
            alert('捕获文档');
        },false)
    </script>
</body>
</html>